//
//  AssistantsViewModel.swift
//  Chatup
//
//  Created by op on 2023/10/19.
//

import Foundation
import FirebaseAnalytics
import SwiftyJSON

@MainActor
class AssistantsViewModel:ObservableObject{
    @Published var showVipView = false
    @Published var showSettingView = false
    @Published var showVip = false
    @Published var leftCount = 3
    @Published var isVip = false
    
    var logfrom = ""
    
    init() {
        logShowAssi()
    }

    func refreshUI() {
        isVip = UserDefaults.standard.bool(forKey: "kWhetherVip")
        leftCount = UserDefaults.standard.integer(forKey: "leftCount")

    }
    
    
}

extension AssistantsViewModel {
    func logShowAssi() {
        Analytics.logEvent("assistant_page_show", parameters: nil)

    }
    func logFreeClick() {
        Analytics.logEvent("assistant_free_click", parameters: nil)

    }
    func logContent(bigId:Int,smallId:Int) {
        Analytics.logEvent("assistant_content", parameters: ["content":"\(bigId).\(smallId)"])

    }
    func logSettingsClick() {
        Analytics.logEvent("assistant_settings", parameters: nil)

    }
    func logChatClick() {
        Analytics.logEvent("assistant_chat", parameters: nil)

    }
    func logDrawClick() {
        Analytics.logEvent("assistant_draw_imagination", parameters: nil)

    }
    func logImagesClick() {
        Analytics.logEvent("assistant_recognize_images", parameters: nil)

    }
    func logDocumentClick() {
        Analytics.logEvent("assistant_summarize_document", parameters: nil)

    }
    func logLinkClick() {
        Analytics.logEvent("assistant_anlyze_link", parameters: nil)

    }
    func logTranslatorClick() {
        Analytics.logEvent("assistant_translator", parameters: nil)

    }
    func logEmojiClick() {
        Analytics.logEvent("assistant_emoji", parameters: nil)

    }
}
